<?php

/**
 * class RPCResponseLayout
 *
 * Description for class RPCResponseLayout
 *
 * @author:
*/
class RPCResponseLayout  {
	
	private $obj;
	
	/**
	 * RPCResponseLayout constructor
	 *
	 *
	 */	
	public function __construct($id){
		$this->obj = new stdClass();
		$this->obj->jsonrpc = "2.1";
		$this->obj->id = $id;
	} 
	
	/**
	 * This is method setResult
	 *
	 * @param mixed $res The result you would like to send back
	 *
	 */	
	public function setResult($res){
		$this->obj->result = $res;
	}
	
	/**
	 * This is method setError
	 *
	 * @param mixed $errNumber This is an error number to send to client
	 * @param mixed $errString This is an error string to send to the client
	 *
	 */	
	public function setError($errNumber, $errString){
		$this->obj->error = new stdClass();
		$this->obj->error->num = $errNumber;
		$this->obj->error->str = $errString;
	}
	
	/**
	 * This is method getGeneratedRPC
	 *
	 * @return mixed returns the JSON-RPC 2.1 Standard to be returned to the client
	 *
	 */	
	public function getGeneratedRPC(){
		return json_encode($this->obj);
	}
	
}

?>